package com.verlet.serviceribbon.controller;

import com.verlet.serviceribbon.service.HelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author verlet
 * @date 2018/8/3
 */
@Slf4j
@RestController
public class HelloController {

    @Autowired
    HelloService helloService;

    @Value("${spring.application.name}")
    String serviceName;

    @GetMapping("/hi")
    public String hi(@RequestParam String name){
        return helloService.hiService(name);
    }

    @RequestMapping("/info")
    public String info(){
        log.info("info is being called");
        return "i`m "+serviceName;
    }

    @RequestMapping("/home")
    public String home(){
        log.info("info is being called");
        return helloService.home();
    }
}
